package top.huhuiyu.springboot3.p2301.task;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import top.huhuiyu.springboot3.p2301.mapper.UtilMapper;

@EnableScheduling
@Component
@RequiredArgsConstructor
@Slf4j
public class UtilTask {
    private final UtilMapper utilMapper;

    @Scheduled(initialDelay = 10 * 1000, fixedDelay = 60 * 1000)
    public void time() {
        log.debug("当前时间：{}", utilMapper.queryNow());
        log.debug("当前时间戳：{}", utilMapper.queryUnixTime());
    }
}
